<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Controller
 *
 * @author juwking
 */
require_once ('Smarty-2.6.26/libs/Smarty.class.php');

abstract class Controller {

    protected $smarty, $template;
    private $logger;
    function __construct() {
        $this->logger= new KLogger ( "log.txt" , KLogger::DEBUG );
        $this->LogInfo("Created object ".get_class($this));

        $this->smarty = new Smarty();
        $this->smarty->template_dir = 'views';
        $this->smarty->compile_dir = 'tmp';
        $this->smarty->assign('page', &$this);

    }
    //public abstract function prepareSite();
    public function LogInfo($message){
        $this->logger->LogInfo($message);
    }
    public function LogDebug($message){
        $this->logger->LogDebug($message);
    }
    public function display() {
        $this->smarty->display($this->getTemplate());
    }

    /**
     * Przeciążyć aby zmienić template
     * @return String
     */
    public function getTemplate() {
        ;
    }

    /**
     * Wrapper metody Smarty
     * @param <type> $smartyHolder
     * @param <type> $content
     */
    public function assign($smartyHolder, $content) {
        $this->smarty->assign($smartyHolder, $content);
    }

    function __destruct() {
        ;
    }

}

?>
